<template>
  <el-form :model="ruleForm" status-icon ref="ruleFormRef">
    <div class="programName">
      <cpro-public title="项目名称" :show-stat="true">
        <template v-slot:content>
          <el-form-item
            prop="projectName"
            :rules="[{ required: true, message: '项目名不能为空', trigger: 'blur' }]"
            class="item"
          >
            <el-input
              class="input"
              v-model="ruleForm.projectName"
              placeholder="请输入需求标题，如美食类电商网站开发、APP开发"
            />
          </el-form-item>
        </template>
      </cpro-public>
    </div>
  </el-form>
</template>

<script lang="ts" setup>
import { reactive, ref, defineExpose, defineEmits } from 'vue'
import { ElMessage } from 'element-plus'
import type { ElForm, FormInstance } from 'element-plus'
import cproPublic from '@/components/creat-projects/cpro-public.vue'
const emit = defineEmits(['updateProgramName'])
const ruleFormRef = ref<FormInstance>()
const ruleForm = reactive({
  projectName: ''
})
const upLoadProjectName = (): Boolean => {
  if (ruleForm.projectName == '') {
    ElMessage({
      showClose: true,
      message: '请填写项目名称',
      type: 'error'
    })
    return false
  }
  emit('updateProgramName', ruleForm.projectName)
  return true
}
defineExpose({ upLoadProjectName })
</script>

<style lang="less" scoped>
.programName {
  .item {
    margin: 0 0 0 8px;
  }
  .input {
    border: 1px solid #e4e4e4;
    border-radius: 5px;
    width: 1069px;
    height: 40px;
    line-height: 40px;
    font-size: 13px;
  }
}
</style>
